ActionController::Routing::Routes.draw do |map|
  map.resources :web_wrappers, :collection => {:test => :post}

  map.resources :comments

  map.resources :users, :collection =>
                          {:login =>:post,
                          :logout =>:get,
                          :confirm_account => :get,
                          :resend_confirmation_link => :get,
                          :confirm_ip => :get,
                          :send_ip_confirmation_link => :get} do |user|
    user.resources :medias, :only => [:index]
  end

  map.resources :medias, :collection => {:search => :get}
  map.connect 'medias/:id/download/*dlpath', :controller => 'medias', :action => 'download'
    
  map.connect 'hella_status', :controller => 'application', :action => 'hella_status', :conditions => {}
  map.connect 'stop_hellanzb', :controller => 'application', :action => 'stop_hellanzb', :conditions => {}
  map.connect 'start_hellanzb', :controller => 'application', :action => 'start_hellanzb', :conditions => {}
  map.connect 'continue_hellanzb', :controller => 'application', :action => 'continue_hellanzb', :conditions => {}

  map.connect 'nzb/search', :controller => 'nzb', :action => 'search', :conditions => { :method => :post }

  map.connect 'nzb/download', :controller => 'nzb', :action => 'download', :conditions => { :method => :post}

  map.connect 'nzb/upload', :controller => 'nzb', :action => 'upload', :conditions => { :method => :post }

  map.resources :nzb,
    :member => {:queue_up => :get, :queue_down => :get, :dequeue => :get},
    :collection => { :cancel_download => :get}

  map.resources :categories, :member => {:update_rss => :get}, :collection => {:update_all_rss => :get, :svn_update => :get} do |categorie|
    categorie.resources :medias, :only => [:index,:show]
  end

  # The priority is based upon order of creation: first created -> highest priority.

  # Sample of regular route:
  #   map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   map.resources :products

  # Sample resource route with options:
  #   map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }

  # Sample resource route with sub-resources:
  #   map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
  
  # Sample resource route with more complex sub-resources
  #   map.resources :products do |products|
  #     products.resources :comments
  #     products.resources :sales, :collection => { :recent => :get }
  #   end

  # Sample resource route within a namespace:
  #   map.namespace :admin do |admin|
  #     # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
  #     admin.resources :products
  #   end

  # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
   map.root :controller => "application"

  # See how all your routes lay out with "rake routes"

  # Install the default routes as the lowest priority.
  # Note: These default routes make all actions in every controller accessible via GET requests. You should
  # consider removing the them or commenting them out if you're using named routes and resources.
  #map.connect ':controller/:action/:id'
  #map.connect ':controller/:action/:id.:format'
end
